<template>
  <el-table
    class="table" border :data="tableData" stripe style="width: 100%"
  >
    <el-table-column prop="id" label="ID" width="180"> </el-table-column>
    <el-table-column prop="date" label="日期" width="180"> </el-table-column>
    <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
    <el-table-column prop="address" label="地址"> </el-table-column>
    <el-table-column prop="file" label="文档">
      <template slot-scope="scope">
        <span v-if="scope.row.file">{{ scope.row.file }}</span>
        <span v-else>无</span>
      </template>
    </el-table-column>
  </el-table>
</template>
<script>
export default {
  data() {
    return {
      tableData: [],
    };
  },
  created() {
    let data = JSON.parse(localStorage.data);
    // console.log(data);
    this.tableData = data.tbody;
  },
  mounted() {
    window.print();
    // 清除本地存储
    localStorage.removeItem('data')
  },
};
</script>
<style scoped>
.table {
  max-width: 860px;
}
</style>